#include <bits/stdc++.h>

using namespace std;

typedef double db;

const int MAXN = 3e6+50;
const db Pi = acos(-1);

struct Comp{
	db x,y;
	Comp(db _x=0.0,db _y=0.0):x(_x),y(_y){}
	friend Comp operator + (Comp a,Comp b){return Comp(a.x+b.x,a.y+b.y);}
	friend Comp operator - (Comp a,Comp b){return Comp(a.x-b.x,a.y-b.y);}
	friend Comp operator * (Comp a,Comp b){return Comp(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x);}
};

Comp F[MAXN],G[MAXN]; int n,m,len,ans[MAXN],rev[MAXN],x;

void change(Comp *f,int l){
	for(int i = 1;i < l;i++) {rev[i] = rev[i>>1]>>1;if(i & 1) rev[i] |= l>>1;}
	for(int i = 1;i < l;i++) if(i < rev[i]) swap(f[i],f[rev[i]]);
}

void fft(Comp *f,int l,int on){
	change(f,l);
	for(int h = 2;h <= l;h <<= 1){
		Comp wn(cos(2*Pi/h),sin(2*Pi*on/h));
		for(int j = 0;j < l;j += h){
			Comp w(1,0);
			for(int k = j;k < j + h/2;k++){
				Comp u = f[k],v = f[k+h/2] * w;
				f[k] = u + v; f[k+h/2] = u - v; w = w*wn;
			}
		}
	}
	if(on == -1) for(int i = 0;i < l;i++) f[i].x /= l;
}
int main (){
	scanf("%d %d",&n,&m);
	for(int i = 0;i <= n;i++) scanf("%d",&x),F[i] = Comp(x,0);
	for(int i = 0;i <= m;i++) scanf("%d",&x),G[i] = Comp(x,0);
	n++,m++,len = 1;while(len < n * 2 || len < m * 2) len <<= 1;
	fft(F,len,1);fft(G,len,1); for(int i = 0;i < len;i++) F[i] = F[i] * G[i]; fft(F,len,-1);
	for(int i = 0;i < len;i++) ans[i] = int(F[i].x+0.5);
	len = n+m-1;for(int i = 0;i < len;i++) printf("%d ",ans[i]);puts("");return 0;
}
